from PySide.QtGui import *
from PySide.QtCore import *


class MainWindow(QDialog):
    
    def __init__(self, *args, **kwargs):
        super(MainWindow, self).__init__(*args, **kwargs)
        self.geometry = None
        
    def closeEvent(self, event):
        self.geometry = self.saveGeometry()
        super(MainWindow, self).closeEvent(event)
        
    def showEvent(self, event):
        if self.geometry is not None:
            self.restoreGeometry(self.geometry)
        super(MainWindow, self).showEvent(event)